<template>
	<view class="user-index">


		<view class="menu">
			<view class="uni-list">
				<view class="uni-list-cell" v-for="(item,index) in menuList" @tap="toTarget(item)" :key="index">
					<view class="uni-list-cell-navigate uni-navigate-right">
						<!-- <view :class="item.icon"></view> -->
						<view>{{item.name}}</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- #ifndef MP-WEIXIN -->
			<view class="logout" @tap="logout()">退出当前帐号</view>
		<!-- #endif -->
		
		
	</view>
</template>

<script>
	
	import Request from '../../common/request.js';
	
	
	export default {
		components: {
			
		},
		data() {
			return {
				token: '',
				menuList: [
// 					{
// 						icon: 'iconfont icon-qianbao text-danger',
// 						name: '个人资料',
// 						url: '',
// 						type: ''
// 					},
					{
						icon: 'iconfont icon-erweima text-danger',
						name: '修改登录密码',
						url: '/pages/my/change-password?type=password',
						type: ''
					},
					{
						icon: 'iconfont icon-dianpu text-danger',
						name: '修改支付密码',
						url: '/pages/my/change-password?type=pay',
						type: ''
					},
// 					{
// 						icon: 'iconfont icon-shoucang1 text-danger',
// 						name: '关于我们',
// 						url: '',
// 						type: ''
// 					},
// 					{
// 						icon: 'iconfont icon-tixian text-danger',
// 						name: '清除缓存',
// 						url: '',
// 						type: ''
// 					}
				]
			};
		},
		onLoad() {
			
		},

		methods:{
			//获取用户信息
			getUserInfo(callback){
				var that = this;				
				var params = {
					url: 'user/index',
					sCallback: function(res) {
						that.userinfo = res.userInfo;
						callback && callback();
					}
				}
				
				Request.send(params);
			},
			//去登录
			logout(){
				uni.removeStorageSync('token');
				uni.removeStorageSync('userinfo');
				uni.reLaunch({
					url:'/pages/my/login'
				})
				
			},
			back(){
				uni.navigateBack({
					
				})
			},
			
			toTarget(item) {
				if(item.type == 'tab') {
					uni.switchTab({
						url: item.url
					})
				} else {
					uni.navigateTo({
						url: item.url
					})
				}
			}
		}
	}
</script>

<style>
	
	
	.menu{
		margin-top: 10upx;
		font-size: 24upx;
	}
	
	.menu .uni-list-cell-navigate{
		justify-content: flex-start;
	}
	
	.menu .uni-list-cell-navigate .iconfont{
		font-size: 40upx;
		margin-right: 10px;
	}
	
	.logout{
		position: fixed;
		bottom: 80upx;
		height: 80upx;
		line-height: 80upx;
		width: 90%;
		margin-left: 5%;
		background: #E60012;
		color: #fff;
		font-size: 28upx;
		text-align: center;
		border-radius: 20upx;
		box-shadow: 0upx 0upx 20upx #8A6DE9;
	}
</style>
